import { Injectable } from '@angular/core';
import { HttpService } from '../../../core/http.service';
import {CommHttpService} from '../../../core/comm.http.service';
import {SERVERS_NAME} from '../../../config/config';

@Injectable()
export class DataDealService extends CommHttpService {

  protected preUrl = `${SERVERS_NAME.DATA_SERVER}backup/`;
  protected preUrl1 = `${SERVERS_NAME.DATA_SERVER}sync/`;

  constructor(
    protected http: HttpService
  ) {
    super(http);
  }

  /**
   * 数据备份
   */
  createData(data) {
    return this.http.post(data, `${this.preUrl1}backupData`);
  }

  /**
   * 数据恢复
   */
  rollbackData(data) {
    return this.http.post(data, `${this.preUrl1}rollbackData`);
  }

  /**
   * AIC到中转库
   */
  syncDataToTransfer() {
    return this.http.get({}, `${this.preUrl1}syncDataToTransfer`);
  }

  /**
   * 中转库同步到本地
   */
  syncTransferToLocal() {
    return this.http.get({}, `${this.preUrl1}syncTransferToLocal`);
  }

}
